/* 
 * Copyright 2008 Lovely Systems GmbH
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package lovely.gwt.jsonrpc.client;

/**
 * Exception thrown when JSON HTTP request fails.
 */
public class JSONHttpException extends Throwable {
	private static final long serialVersionUID = 4367040258179692625L;
	private int httpStatusCode;
	private String httpStatusText;
	private String text;

	public JSONHttpException() {
	}

	public JSONHttpException(String message) {
		super(message);
	}

	public JSONHttpException(Throwable innerException) {
		super(innerException);
	}

	public JSONHttpException(String message, Throwable innerException) {
		super(message, innerException);
	}

	public JSONHttpException(int httpStatusCode, String httpStatusText,
			String text) {
		super("HTTP error: " + httpStatusCode + "\nStatus text:"
				+ httpStatusText + "\nText:" + text);
		this.httpStatusCode = httpStatusCode;
		this.httpStatusText = httpStatusText;
		this.text = text;
	}

	public int getHttpStatusCode() {
		return httpStatusCode;
	}

	public String getHttpStatusText() {
		return httpStatusText;
	}

	public String getText() {
		return text;
	}

}
